﻿using PesticideManage.API.Services.Files.Models;

namespace PesticideManage.API.Services.Files;

public class StoreFactory : IStoreFactory
{
    private readonly LocalStoreService _localStore;
    private readonly TencentCosService _cos;

    public StoreFactory(LocalStoreService localStore, TencentCosService cos)
    {
        _localStore = localStore;
        _cos = cos;
    }
    public IStoreService Create(StoreSource source)
    {
        return source switch
        {
            StoreSource.Local => _localStore,
            StoreSource.TencentCos => _cos,
            _ => throw new ArgumentException("StoreSource 错误", nameof(source)),
        };
    }
}
